package avicit.bdp.dcs.desensitization.dto;

import avicit.bdp.common.base.BaseDTO;
import avicit.platform6.core.annotation.log.FieldRemark;
import avicit.platform6.core.annotation.log.Id;
import avicit.platform6.core.annotation.log.LogField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang3.StringUtils;

import javax.persistence.Column;
import javax.persistence.Table;

/**
 * @金航数码科技有限责任公司
 * @作者：developer
 * @邮箱：developer@avic-digital.com
 * @创建时间： 2021-08-02
 * @类说明：DataMaskingPolicyDto
 * @修改记录：
 * @注意事项：
 * @主要功能：数据脱敏策略DTO
 */
@ApiModel(value = "DataMaskingPolicyDto", description = "bdp_dcs_data_masking_policy")
@Table(name = "bdp_dcs_data_masking_policy")
public class DataMaskingPolicyDto extends BaseDTO {
    /**
     * 主键ID
     */
    @Id
    @LogField
    @ApiModelProperty(value = "主键")
    @FieldRemark(column = "id", field = "id", name = "id")
    @javax.persistence.Id
    @Column(name = "id")
    private String id;

    /**
     * 脱敏策略名称
     */
    @LogField
    @ApiModelProperty(value = "脱敏算法名称")
    @FieldRemark(column = "name", field = "name", name = "权限名称")
    @Column(name = "name")
    private String name;

    /**
     * 描述
     */
    @LogField
    @ApiModelProperty(value = "描述")
    @FieldRemark(column = "remark", field = "remark", name = "描述")
    @Column(name = "remark")
    private String remark;

    /**
     * 算法类型，包括哈希、掩码、变换、加密四种
     */
    @LogField
    @ApiModelProperty(value = "算法类型，包括哈希、掩码、变换、加密四种")
    @FieldRemark(column = "algo_type", field = "algo_type", name = "算法类型，包括哈希、掩码、变换、加密四种")
    @Column(name = "algo_type")
    private String algoType;

    /**
     * 脱敏算法ID
     */
    @LogField
    @ApiModelProperty(value = "脱敏算法ID")
    @FieldRemark(column = "algo_id", field = "algo_id", name = "脱敏算法ID")
    @Column(name = "algo_id")
    private String algoId;

    /**
     * 脱敏算法名称
     */
    @LogField
    @ApiModelProperty(value = "脱敏算法名称")
    @FieldRemark(column = "algo_name", field = "algo_name", name = "脱敏算法名称")
    @Column(name = "algo_name")
    private String algoName;

    /**
     * 输入参数
     */
    @LogField
    @ApiModelProperty(value = "输入参数")
    @FieldRemark(column = "paras", field = "paras", name = "输入参数")
    @Column(name = "paras")
    private String paras;

    public DataMaskingPolicyDto() {
    }

    public DataMaskingPolicyDto(DataMaskingPolicyDto.Builder builder) {
        this.id = builder.id;
        this.name = builder.name;
        this.remark = builder.remark;
        this.algoType = builder.algoType;
        this.algoId = builder.algoId;
        this.algoName = builder.algoName;
        this.paras = builder.paras;
    }

    public String getId() {
        return id;
    }

    public String getName() {
        return name;
    }

    public String getRemark() {
        return remark;
    }

    public String getAlgoType() {
        return algoType;
    }

    public String getAlgoId() {
        return algoId;
    }

    public String getAlgoName() {
        return algoName;
    }

    public String getParas() {
        return paras;
    }

    public void setId(String id) {
        this.id = id;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public void setAlgoType(String algoType) {
        this.algoType = algoType;
    }

    public void setAlgoId(String algoId) {
        this.algoId = algoId;
    }

    public void setAlgoName(String algoName) {
        this.algoName = algoName;
    }

    public void setParas(String paras) {
        this.paras = paras;
    }

    @Override
    public String getLogFormName() {
        if (StringUtils.isEmpty(super.logFormName)) {
            return "数据脱敏策略管理";
        } else {
            return super.logFormName;
        }
    }

    @Override
    public String getLogTitle() {
        if (StringUtils.isEmpty(super.logTitle)) {
            return "数据脱敏策略";
        } else {
            return super.logTitle;
        }
    }

    /**
     * Builder构造类
     */
    public static final class Builder {
        private String id;
        private String name;
        private String remark;
        private String algoType;
        private String algoId;
        private String algoName;
        private String paras;

        private Builder() {
        }

        public DataMaskingPolicyDto.Builder id(String id) {
            this.id = id;
            return this;
        }

        public DataMaskingPolicyDto.Builder name(String name) {
            this.name = name;
            return this;
        }

        public DataMaskingPolicyDto.Builder remark(String remark) {
            this.remark = remark;
            return this;
        }

        public DataMaskingPolicyDto.Builder algoType(String algoType) {
            this.algoType = algoType;
            return this;
        }

        public DataMaskingPolicyDto.Builder algoId(String algoId) {
            this.algoId = algoId;
            return this;
        }

        public DataMaskingPolicyDto.Builder algoName(String algoName) {
            this.algoName = algoName;
            return this;
        }

        public DataMaskingPolicyDto.Builder paras(String paras) {
            this.paras = paras;
            return this;
        }

        public DataMaskingPolicyDto build() {
            DataMaskingPolicyDto dataMaskingPolicyDto = new DataMaskingPolicyDto();
            dataMaskingPolicyDto.setId(id);
            dataMaskingPolicyDto.setName(name);
            dataMaskingPolicyDto.setRemark(remark);
            dataMaskingPolicyDto.setAlgoType(algoType);
            dataMaskingPolicyDto.setAlgoId(algoId);
            dataMaskingPolicyDto.setAlgoName(algoName);
            dataMaskingPolicyDto.setParas(paras);

            return dataMaskingPolicyDto;
        }
    }
}